.modal-header
	h4.modal-title
		span(ng-if="!tpl.id") New Template
		span(ng-if="tpl.id") Update Template
.modal-body
	form.form-horizontal
		.form-group
			label.control-label.col-sm-4 Playbook Alias
			.col-sm-6
				input.form-control(type="text" placeholder="USA Servers" ng-model="tpl.alias")

		.form-group(ng-if="tpl.id")
			label.control-label.col-sm-4 Template ID
			.col-sm-6
				input.form-control(type="text" readonly="readonly" ng-model="tpl.id")

		.form-group
			label.control-label.col-sm-4 Playbook Name
			.col-sm-6
				input.form-control(type="text" placeholder="play.yml" ng-model="tpl.playbook")

		.form-group
			label.control-label.col-sm-4 SSH Key*
			.col-sm-6
				select.form-control(ng-model="tpl.ssh_key_id" ng-options="key.id as key.name disable when key.removed for key in keys")
					option(value="") -- Select SSH Key --
		.form-group
			label.control-label.col-sm-4 Inventory*
			.col-sm-6
				select.form-control(ng-model="tpl.inventory_id" ng-options="inv.id as inv.name disable when inv.removed for inv in inventory")
					option(value="") -- Select Inventory --
		.form-group
			label.control-label.col-sm-4 Playbook Repository*
			.col-sm-6
				select.form-control(ng-model="tpl.repository_id" ng-options="repo.id as repo.name disable when repo.removed for repo in repositories")
					option(value="") -- Select Playbook Repository --
		.form-group
			label.control-label.col-sm-4 Environment
			.col-sm-6
				select.form-control(ng-model="tpl.environment_id" ng-options="env.id as env.name disable when env.removed for env in environment")
					option(value="") -- Select Task Environment --
		.form-group
			label.control-label.col-sm-4(style="font-weight: normal;") (*) required fields

		hr
		.form-group
			label.control-label.col-sm-4(uib-tooltip='*MUST* be a JSON array! Each argument must be an element of the array, for example: ["-i", "@myinventory.sh", "--private-key=/there/id_rsa", "-vvvv"]') Extra CLI Arguments
			.col-sm-6
				div(ui-ace="{mode: 'json', workerPath: '/public/js/ace/'}" style="height: 100px" class="form-control" ng-model="tpl.arguments")
		.form-group
			.col-sm-6.col-sm-offset-4
				.checkbox(uib-tooltip="Usually semaphore prepends arguments like `--private-key=/location/id_rsa` to make sure everything goes smoothly. This option is for special needs, where semaphore conflicts with one of your arguments."): label
					input(type="checkbox" ng-model="tpl.override_args")
					| Override semaphore arguments
.modal-footer
	button.btn.btn-default.pull-left(ng-click="$dismiss()") Dismiss
	button.btn.btn-danger(ng-if="tpl.id" ng-click="$close({ remove: true })") remove
	button.btn.btn-success(ng-click="$close({ template: tpl })")
		span(ng-if="!tpl.id") Create
		span(ng-if="tpl.id") Update
